/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication13;

/**
 *
 * @author Irina
 */
public class Factory {
    ICommandExecutor ic;
    
    ICommandExecutor getComandExecutor(String cmd)  
    {
        if ("dir".equals(cmd))
        {
            ic=Directory.getInstance();
            return ic;
        }   else if("tree".equals(cmd))
        {
            ic=Tree.getInstance();
            return ic;         
        }   else if("find".equals(cmd))
        {                  
            ic=Find.getInstance();
            return ic;       
        }   else if("mkdir".equals(cmd))
        {        
            ic=Mkdir.getInstance();
            return ic; 
        }   else if("copy".equals(cmd))
        {
            ic=Copy.getInstance();
            return ic; 
        }   else if("move".equals(cmd))
        {
             ic=Move.getInstance();
            return ic; 
        }   else if("delete".equals(cmd))
        {
            ic=Delete.getInstance();
            return ic; 
        }   else if ("exit".equals(cmd))
        {
            ic=Exit.getInstance();
            return ic;
       }else if ("help".equals(cmd))
        {
            ic=Help.getInstance();
            return ic;
        }else if ("cd".equals(cmd))
        {
            ic=Cd.getInstance();
            return ic;
        }else
        System.out.println("Команда не распознана.Повторите попытку.");
        return null;
    }
}

